package com.whq.thrift.api.web.admin.service.requestlog.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.whq.thrift.api.common.spring.datasource.DataSourceContextHolder;
import com.whq.thrift.api.web.admin.db.requestlog.StatRequestHourApiData;
import com.whq.thrift.api.web.admin.db.requestlog.StatRequestHourApiDataMapper;
import com.whq.thrift.api.web.admin.service.requestlog.StatRequestHourApiDataService;

@Service
public class StatRequestHourApiDataServiceImpl implements StatRequestHourApiDataService {
	@Autowired
	private StatRequestHourApiDataMapper statRequestHourApiDataMapper;

	public List<StatRequestHourApiData> findRecrods(Map<String, Object> whereParams, int beginIndex, int maxCount) {
		DataSourceContextHolder.set("dataSourceRequestLog");
		if (whereParams == null) {
			whereParams = new HashMap<String, Object>(0);
		}
		whereParams.put("beginIndex", beginIndex);
		whereParams.put("maxCount", maxCount);
		return this.statRequestHourApiDataMapper.findRecrodByMap(whereParams);
	}

	public int findRecrodCount(Map<String, Object> whereParams) {
		DataSourceContextHolder.set("dataSourceRequestLog");
		return this.statRequestHourApiDataMapper.findRecrodByCount(whereParams);
	}

}
